package cn.quevo.ucenter.server.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.quevo.core.exception.CustomException;
import cn.quevo.ucenter.core.entity.User;
import cn.quevo.ucenter.server.dao.UserDao;
import cn.quevo.ucenter.server.entity.query.UserQuery;
import cn.quevo.ucenter.server.service.UserService;

/**
 * 用户Service接口
 * 
 * @author July july_sky@foxmail.com
 * @date 2018年3月26日 下午10:17:38
 * @Copyright ©2015-2035 湘豫(北京)科技有限公司. All Rights Reserved.
 * @version 1.0
 */
@Service("userService")
@Transactional(transactionManager="transactionManager",rollbackFor={Exception.class})
public class UserServiceImpl implements UserService {

    @Resource(name = "userDao")
    private UserDao userDao;
    
    @Override
    public Integer createUser(User user) throws CustomException {
        return this.userDao.create(user);
    }

    @Override
    public Integer updateUserPasswd(User user) throws CustomException {
        return this.userDao.update(user);
    }

    @Override
    public Integer destroyUser(User user) throws CustomException {
        return this.userDao.delete(user);
    }

    @Override
    public User getUserByName(UserQuery userQuery) throws CustomException {
        return this.userDao.getSinge(userQuery);
    }

}
